//
// Created by liushuai on 18-10-29.
//

#include "Array.h"
#include <iostream>
Array::Array(int c):count(c) {
    int* p_arr = new int[count];
    for(int i=0;i<count;i++)
        p_arr[i] = i;
    std::cout<<"Construct: "<<"\n";
}
//浅拷贝
//Array::Array(const Array &a) {
//    count = a.count;
//    std::cout<<"Copy Construct"<<"\n";
//}
//深拷贝
Array::Array(const Array &a) {
    count = a.count;
    p_arr = new int[count];
    for(int i=0;i<count;i++)
        p_arr[i] = a.p_arr[i];
    std::cout<<"Copy Construct"<<"\n";
}
void Array::set_count(int c) {
    count = c;
}
Array::~Array() {
    delete  [] p_arr;
    p_arr = nullptr;
    std::cout<<"Destroy Array "<<"\n";
}
int Array::get_count() {
    return count;
}
void Array::show_address() {
    std::cout<<p_arr<<"\n";
}